import 'scss/page-layout.scss'; // 公共标准布局样式，如采用公共标准务必引用
import Vue from 'vue';
import reset from './reset/reset';
import BtUi from 'bontal-base-ui';
import 'bontal-base-ui/dist/bontal-base-ui.css';
import { cacheUtil } from 'utils/util'; // 缓存工具类
Vue.use(BtUi);

window.Message = BtUi.Message;
window.MessageBox = BtUi.MessageBox;

// 获取url参数
const getUrlParam = (name) => {
  const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
  const str = window.location.search;
  let r = '';
  if (str.substring(0, 4) === '?id=') {
    r = str.substr(1).match(reg);
  } else {
    r = decodeURIComponent(window.atob(str.substr(1))).match(reg);
  }
  if (r != null) return unescape(r[2]); return null;
};
new Vue({
  el: '#main-box',
  components: {
    reset
  },
  data() {
    const id = getUrlParam('id');
    let token = ''; let userId = ''; let from = '';
    if (!id) {
      const oper = JSON.parse(cacheUtil.getCookies('oper'));
      from = getUrlParam('from') || '';
      if (oper) {
        userId = oper.c_oper_code || '';
      }
      token = cacheUtil.getCookies('Authorization') || '';
    }
    // let userId = getUrlParam('userId');
    // let token = getUrlParam('token');
    // let from = getUrlParam('from');
    return {
      args: {
        ID: id,
        UserId: userId,
        Token: token,
        From: from
      }
    };
  },
  created() {
  },
  mounted() {
  },
  methods: {
  }
});
